package net.adetech.cjg.innerservice.mapper;


import net.adetech.cjg.innerservice.entity.Sqjl;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface SqjlDao {

    @Insert("insert into cjg_sqjl(id, ywlx, ywlxmc, blr, xm, scsj, scry, scrymc, wcsj, sfzh, hjdz, sjhm, lsh, pdh, dhhm, cph, wszl, wshm, llzl, llhm, yjdz, yjdh, wczt,org_code,hphm , ywfl, bljd,dybz) values" +
            " (#{id}, #{ywlx,jdbcType=VARCHAR}, #{ywlxmc,jdbcType=VARCHAR}, #{blr,jdbcType=VARCHAR}, #{xm,jdbcType=VARCHAR}, sysdate , #{scry,jdbcType=VARCHAR}, #{scrymc,jdbcType=VARCHAR}, #{wcsj,jdbcType=TIMESTAMP}, #{sfzh,jdbcType=VARCHAR}, " +
            "#{hjdz,jdbcType=VARCHAR}, #{sjhm,jdbcType=VARCHAR}, #{lsh,jdbcType=VARCHAR}, #{pdh,jdbcType=NUMERIC}, #{dhhm,jdbcType=VARCHAR}, #{cph,jdbcType=VARCHAR}, #{wszl,jdbcType=VARCHAR}, #{wshm,jdbcType=VARCHAR}, #{llzl,jdbcType=VARCHAR}, #{llhm,jdbcType=VARCHAR}, " +
            "#{yjdz,jdbcType=VARCHAR}, #{yjdh,jdbcType=VARCHAR}, #{wczt,jdbcType=VARCHAR}, #{orgCode,jdbcType=VARCHAR}, #{hphm,jdbcType=VARCHAR},  #{ywfl,jdbcType=VARCHAR},  #{bljd,jdbcType=VARCHAR},  #{dybz,jdbcType=VARCHAR})")
    void saveSqjl(Sqjl sqjl);


    @Select("select * from cjg_sqjl where lsh = #{lsh}")
    Sqjl getSqjlByLsh(String lsh);


    @Update("update cjg_sqjl set ym_json = #{ymJson,jdbcType=CLOB} where lsh = #{lsh}")
    void updateYmJson(@Param("lsh") String lsh, @Param("ymJson") String ymJson);


    @Select("select * from cjg_sqjl ")
    List<Sqjl> getAllSqjl();


    @Select("select SEQ_SQJL_ID.nextval from dual")
    long getCommonId();


    @Insert("insert into cjg_sqjl_json(id,ym_json) values" +
            " (#{id}, #{ymJson,jdbcType=VARCHAR})")
    void saveSqjlJson(Sqjl sqjl);
}
